package com.shangguosha.core.event;

import lombok.Data;

/**
 * 游戏事件基类
 */
@Data
public abstract class GameEvent {
    protected String eventType;
    protected Object source;
    protected long timestamp;
    protected boolean cancelled;
    
    public GameEvent(String eventType, Object source) {
        this.eventType = eventType;
        this.source = source;
        this.timestamp = System.currentTimeMillis();
        this.cancelled = false;
    }
    
    /**
     * 取消事件
     */
    public void cancel() {
        this.cancelled = true;
    }
    
    @Override
    public String toString() {
        return String.format("%s[type=%s, source=%s, timestamp=%d]", 
            this.getClass().getSimpleName(), eventType, source, timestamp);
    }
}